const jwt = require('jsonwebtoken');


module.exports = () => {
  return async (ctx, next) => {
    try {
      const token = ctx.header.authority;
      jwt.verify(token, 'zj');
      await next();
    } catch (error) {
      ctx.body = {
        code: 401,
        msg: 'token过期了，请重新登录',
      };
      return;
    }
  };

};
